package com.itheima.server.util;

import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 阿鹏
 * @date 2021/1/23 21:14
 */

public class JwtUtils {

    public static String createToken(String mobile, Long userId, String secret) {
        Map<String, Object> claims = new HashMap<>();
        claims.put("mobile", mobile);
        claims.put("id", userId);
        return Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS256, secret).compact();
    }
}
